home *** CD-ROM | disk | FTP | other *** search
/ Cre@te Online 2000 December / Cre@teOnline CD05.iso / MacSoft / XML ConsoleMax.sea / XML ConsoleMax / Required / esc.jar / com / extensibility / xml / AttributeDeclaration.class (.txt) next >
Encoding:
Java Class File  |  2000-06-30  |  16.0 KB  |  703 lines

  1. package com.extensibility.xml;
  2.  
  3. import com.extensibility.util.Debug;
  4. import com.extensibility.util.StringUtilities;
  5. import com.extensibility.xml.dt.DataType;
  6. import com.extensibility.xml.dt.DataTypeFactory;
  7. import com.extensibility.xml.dt.DataTypeIntf;
  8. import com.extensibility.xml.dt.Facet;
  9. import java.io.IOException;
  10. import java.io.Writer;
  11. import java.util.Enumeration;
  12. import java.util.Hashtable;
  13. import java.util.MissingResourceException;
  14. import java.util.Vector;
  15. import javax.swing.event.ChangeListener;
  16.  
  17. public class AttributeDeclaration extends BaseDeclaration implements Cloneable, AttributeGroupMember, QualifiedName {
  18.    public static final int UNKNOWN = 0;
  19.    public static final int CDATA = 1;
  20.    // $FF: renamed from: ID int
  21.    public static final int field_0 = 2;
  22.    public static final int IDREF = 3;
  23.    public static final int IDREFS = 4;
  24.    public static final int ENTITY = 5;
  25.    public static final int ENTITIES = 6;
  26.    public static final int NMTOKEN = 7;
  27.    public static final int NMTOKENS = 8;
  28.    public static final int NOTATION = 9;
  29.    public static final int ENUMERATION = 10;
  30.    Owner owner;
  31.    boolean required;
  32.    String defaultValue;
  33.    DataType dataType;
  34.    boolean isReferenceToGlobal;
  35.    ChangeListener changerType;
  36.  
  37.    public AttributeDeclaration(String var1) {
  38.       super(var1);
  39.       this.required = false;
  40.       this.changerType = new 1(this);
  41.       this.setDataType(DataTypeFactory.createDataType(1), false);
  42.    }
  43.  
  44.    public AttributeDeclaration(Owner var1, String var2, DataType var3, Vector var4, boolean var5, String var6) {
  45.       this(var1, var2, var3, var5, var6);
  46.       if (var4 != null && var4.size() > 0) {
  47.          Facet var7 = new Facet(Facet.FACET_ENUM_NAME, var4);
  48.          this.setDataType((DataType)this.dataType.applyFacet(var7), false);
  49.       }
  50.  
  51.    }
  52.  
  53.    public AttributeDeclaration(Owner var1, String var2, DataType var3, boolean var4, String var5) {
  54.       super(var2);
  55.       this.required = false;
  56.       this.changerType = new 1(this);
  57.       this.owner = var1;
  58.       this.setDataType(var3, false);
  59.       this.required = var4;
  60.       if (var5 != null) {
  61.          this.defaultValue = var5;
  62.       }
  63.  
  64.    }
  65.  
  66.    public AttributeDeclaration(Owner var1, String var2) {
  67.       this(var1, var2, DataTypeFactory.createDataType(1), false, (String)null);
  68.    }
  69.  
  70.    public Object clone(Owner var1) {
  71.       AttributeDeclaration var2 = (AttributeDeclaration)this.clone();
  72.       var2.owner = var1;
  73.       if (var1 != null) {
  74.          var1.add(var2);
  75.       }
  76.  
  77.       return var2;
  78.    }
  79.  
  80.    public BaseDeclaration clone(SchemaIntf var1, SchemaIntf var2, URI var3) {
  81.       Owner var4 = this.getOwner();
  82.       String var5 = var4.getName();
  83.       Object var6;
  84.       if (var4 instanceof InternalPEDeclaration) {
  85.          var6 = (InternalPEDeclaration)var2.getNamedDeclaration(var5, Class.forName("com.extensibility.xml.InternalPEDeclaration"));
  86.       } else {
  87.          var6 = var2.getNamedElement(var5);
  88.       }
  89.  
  90.       if (var6 == null) {
  91.          var6 = var2.createUnknownOwner(var5);
  92.       }
  93.  
  94.       AttributeDeclaration var7 = (AttributeDeclaration)this.clone((Owner)var6);
  95.       ((BaseDeclaration)var7).setURI(var3);
  96.       return var7;
  97.    }
  98.  
  99.    public Object clone() {
  100.       AttributeDeclaration var1 = null;
  101.  
  102.       try {
  103.          var1 = (AttributeDeclaration)super.clone();
  104.          if (this.dataType != null) {
  105.             var1.setDataType((DataType)this.dataType.clone(), false);
  106.          }
  107.       } catch (CloneNotSupportedException var3) {
  108.          Debug.assert(false, "Problem cloning AttributeDeclaration.");
  109.       }
  110.  
  111.       return var1;
  112.    }
  113.  
  114.    public String getPrefix() {
  115.       int var1 = super.name.indexOf(58);
  116.       return var1 == -1 ? null : super.name.substring(0, var1);
  117.    }
  118.  
  119.    public String getNCName() {
  120.       return super.name.substring(super.name.indexOf(58));
  121.    }
  122.  
  123.    public String getNamespace() {
  124.       if (this.getPrefix() == null) {
  125.          return null;
  126.       } else if (((BaseDeclaration)this).getSchema() == null) {
  127.          return null;
  128.       } else {
  129.          NamespaceDeclaration var1 = ((BaseDeclaration)this).getSchema().getNamedNamespace(this.getPrefix());
  130.          return var1 == null ? null : var1.getNamespace();
  131.       }
  132.    }
  133.  
  134.    public boolean isQualified() {
  135.       return super.name.indexOf(58) >= 0;
  136.    }
  137.  
  138.    public String getClassName() {
  139.       return "com.extensibility.xml.AttributeDeclaration";
  140.    }
  141.  
  142.    public void resetOwner() {
  143.       this.owner = null;
  144.    }
  145.  
  146.    public void setOwner(Owner var1) {
  147.       Owner var2 = this.owner;
  148.       if (var2 != var1) {
  149.          this.owner = var1;
  150.          ((BaseDeclaration)this).fireChangeEvent(12, var2);
  151.       }
  152.    }
  153.  
  154.    public boolean references(InternalPEDeclaration var1) {
  155.       String var2 = String.valueOf("%").concat(String.valueOf(((BaseDeclaration)var1).getName()));
  156.       if (this.defaultValue != null && this.defaultValue.indexOf(var2) >= 0) {
  157.          return true;
  158.       } else if (this.dataType.hasFacet(Facet.FACET_ENUM_NAME) && this.dataType.enumContains(var2)) {
  159.          return true;
  160.       } else {
  161.          var2 = String.valueOf(String.valueOf("%").concat(String.valueOf(((BaseDeclaration)var1).getName()))).concat(String.valueOf(";"));
  162.          if (this.defaultValue != null && this.defaultValue.indexOf(var2) >= 0) {
  163.             return true;
  164.          } else {
  165.             return this.dataType.hasFacet(Facet.FACET_ENUM_NAME) && this.dataType.enumContains(var2);
  166.          }
  167.       }
  168.    }
  169.  
  170.    public void setRequired(boolean var1) {
  171.       this.required = var1;
  172.       ((BaseDeclaration)this).fireChangeEvent(17, new Boolean(var1));
  173.    }
  174.  
  175.    public void setOptions(String var1) {
  176.       String var2 = this.getOptions();
  177.       if (this.dataType != null) {
  178.          this.setDataType((DataType)this.dataType.setOptions(var1), false);
  179.       }
  180.  
  181.       ((BaseDeclaration)this).fireChangeEvent(15, var2);
  182.    }
  183.  
  184.    public String getOptions() {
  185.       return this.dataType == null ? new String("") : this.dataType.getOptions();
  186.    }
  187.  
  188.    public Hashtable getChoicesExplains() {
  189.       if (this.dataType != null) {
  190.          Facet var1 = this.dataType.getFacet(Facet.FACET_ENUM_NAME);
  191.          if (var1 != null) {
  192.             return var1.getExplains();
  193.          }
  194.       }
  195.  
  196.       return null;
  197.    }
  198.  
  199.    public void setChoices(Vector var1) {
  200.       this.setChoices(var1, (Hashtable)null);
  201.    }
  202.  
  203.    public void setChoices(Vector var1, Hashtable var2) {
  204.       if (this.dataType != null) {
  205.          Facet var4 = new Facet(Facet.FACET_ENUM_NAME, var1);
  206.          if (var2 != null) {
  207.             var4.setExplains(var2);
  208.          }
  209.  
  210.          this.setDataType((DataType)this.dataType.applyFacet(var4), false);
  211.       }
  212.  
  213.       ((BaseDeclaration)this).fireChangeEvent(15, var1);
  214.    }
  215.  
  216.    public void setDefault(String var1) {
  217.       String var2 = this.defaultValue;
  218.       this.defaultValue = var1;
  219.       ((BaseDeclaration)this).fireChangeEvent(16, var2);
  220.    }
  221.  
  222.    public String getTypeForDisplay(SchemaIntf var1) {
  223.       return var1.getDataTypeDisplay(this.dataType);
  224.    }
  225.  
  226.    public boolean isID() {
  227.       return this.dataType == DataTypeFactory.createDataType(2);
  228.    }
  229.  
  230.    public Owner getOwner() {
  231.       return this.owner;
  232.    }
  233.  
  234.    public Vector getPrerequisites(SchemaIntf var1) {
  235.       Vector var2 = super.getPrerequisites(var1);
  236.       if (this.owner instanceof InternalPEDeclaration) {
  237.          var2.addElement(this.owner);
  238.       }
  239.  
  240.       BaseDeclaration.addPrerequisite(var1, var2, this.getDefault(), false);
  241.       BaseDeclaration.addPrerequisite(var1, var2, this.getDefault(), true);
  242.       Vector var3 = this.getChoices();
  243.       if (var3 != null) {
  244.          for(int var4 = 0; var4 < var3.size(); ++var4) {
  245.             BaseDeclaration.addPrerequisite(var1, var2, (String)var3.elementAt(var4), true);
  246.          }
  247.       }
  248.  
  249.       return var2;
  250.    }
  251.  
  252.    public boolean isPrimitive() {
  253.       return this.dataType == null || DataTypeFactory.isPrimitive(this.dataType) || this.dataType.equals(DataTypeFactory.createDataType(DataTypeIntf.NOTATED));
  254.    }
  255.  
  256.    public String getTypeAsPrimitiveSource() {
  257.       if (this.isPrimitive()) {
  258.          if (this.dataType.equalsSource(DataTypeIntf.STRING)) {
  259.             return "CDATA";
  260.          } else {
  261.             return this.dataType.isEnumeration() ? "" : this.dataType.getSource();
  262.          }
  263.       } else {
  264.          return "CDATA";
  265.       }
  266.    }
  267.  
  268.    public String getDefaultSource(char var1, String var2) {
  269.       if (this.required) {
  270.          if (this.defaultValue == null) {
  271.             return "#REQUIRED";
  272.          } else if (this.isNmTokens() && this.defaultValue.indexOf(37) < 0 && this.defaultValue.indexOf(38) < 0) {
  273.             Vector var3 = StringUtilities.parseNames(this.defaultValue);
  274.             if (var3.size() % 2 == 0 && var3.size() != 0) {
  275.                String var4 = "                                                                                                                              ";
  276.                int var5 = 0;
  277.  
  278.                for(int var6 = var3.size() - 2; var6 >= 0; var6 -= 2) {
  279.                   var5 = Math.max(var5, ((String)var3.elementAt(var6)).length());
  280.                }
  281.  
  282.                StringBuffer var7 = new StringBuffer();
  283.                var7.append(var1);
  284.                int var8 = 0;
  285.  
  286.                while(var8 < var3.size() - 1) {
  287.                   if (var8 > 0) {
  288.                      var7.append(BaseDeclaration.LINE_SEPARATOR);
  289.                      var7.append(var2);
  290.                      var7.append("  ");
  291.                   }
  292.  
  293.                   String var9 = (String)var3.elementAt(var8++);
  294.                   String var10 = (String)var3.elementAt(var8++);
  295.                   var7.append(var9);
  296.                   var7.append(var4.substring(0, var5 - var9.length()));
  297.                   var7.append(" ");
  298.                   var7.append(var10);
  299.                }
  300.  
  301.                var7.append(var1);
  302.                return var7.toString();
  303.             } else {
  304.                return String.valueOf("#FIXED ").concat(String.valueOf(StringUtilities.doubleQuoted(this.defaultValue)));
  305.             }
  306.          } else {
  307.             return String.valueOf("#FIXED ").concat(String.valueOf(StringUtilities.quoted(this.defaultValue, var1)));
  308.          }
  309.       } else {
  310.          return this.defaultValue == null ? "#IMPLIED" : StringUtilities.quoted(this.defaultValue, var1);
  311.       }
  312.    }
  313.  
  314.    public boolean isNmTokens() {
  315.       return this.dataType.isNmTokens();
  316.    }
  317.  
  318.    public boolean isNotation() {
  319.       return this.dataType.isNotation();
  320.    }
  321.  
  322.    public boolean isEnumeration() {
  323.       return this.dataType.isEnumeration();
  324.    }
  325.  
  326.    public String getChoicesSource(String var1) {
  327.       if (!this.isNotation() && !this.isEnumeration()) {
  328.          return "";
  329.       } else {
  330.          StringBuffer var2 = new StringBuffer(" (");
  331.          Vector var3 = this.getChoices();
  332.          if (var3 != null) {
  333.             if (var1 != null) {
  334.                int var4 = 2 + var1.length();
  335.  
  336.                for(int var5 = 0; var5 < var3.size() - 1; ++var5) {
  337.                   var4 += ((String)var3.elementAt(var5)).length() + 3;
  338.                }
  339.  
  340.                if (var4 < 80) {
  341.                   var1 = null;
  342.                }
  343.             }
  344.  
  345.             Enumeration var6 = var3.elements();
  346.  
  347.             while(var6.hasMoreElements()) {
  348.                var2.append(DTDUtilities.convertPEReferences((String)var6.nextElement(), true));
  349.                if (var6.hasMoreElements()) {
  350.                   var2.append(" | ");
  351.                   if (var1 != null) {
  352.                      var2.append(BaseDeclaration.LINE_SEPARATOR);
  353.                      var2.append(var1);
  354.                      var2.append(" ");
  355.                   }
  356.                }
  357.             }
  358.          }
  359.  
  360.          var2.append(" ) ");
  361.          return var2.toString();
  362.       }
  363.    }
  364.  
  365.    public boolean getRequired() {
  366.       return this.required;
  367.    }
  368.  
  369.    public Vector getChoices() {
  370.       Vector var1 = null;
  371.       if (this.dataType.hasFacet(Facet.FACET_ENUM_NAME)) {
  372.          Facet var2 = this.dataType.getFacet(Facet.FACET_ENUM_NAME);
  373.          if (var2 != null) {
  374.             var1 = (Vector)var2.getValue();
  375.          }
  376.       }
  377.  
  378.       return var1;
  379.    }
  380.  
  381.    private void expandChoices(Enumeration var1, Vector var2) {
  382.       while(var1.hasMoreElements()) {
  383.          String var3 = ((String)var1.nextElement()).trim();
  384.          if (var3.length() > 0 && var3.charAt(0) == '%') {
  385.             String var4 = super.schema.expandPERefs(var3, this);
  386.             if (var4.indexOf("|") != -1) {
  387.                Enumeration var5 = StringUtilities.extract(var4, "|").elements();
  388.                this.expandChoices(var5, var2);
  389.             } else {
  390.                var2.addElement(var4);
  391.             }
  392.          } else {
  393.             var2.addElement(var3);
  394.          }
  395.       }
  396.  
  397.    }
  398.  
  399.    public Enumeration getChoices(SchemaIntf var1, boolean var2) {
  400.       Vector var3 = this.getChoices();
  401.       if (var3 == null) {
  402.          return (new Vector()).elements();
  403.       } else if (!var2) {
  404.          return var3.elements();
  405.       } else {
  406.          Vector var4 = new Vector();
  407.          this.expandChoices(var3.elements(), var4);
  408.          return var4.elements();
  409.       }
  410.    }
  411.  
  412.    public String getDefault() {
  413.       return this.defaultValue;
  414.    }
  415.  
  416.    public void checkForErrors(SchemaIntf var1) {
  417.       super.checkForErrors(var1);
  418.       if (this.owner instanceof ElementDeclaration && var1.getNamedDeclaration(this.owner.getName(), Class.forName("com.extensibility.xml.ElementDeclaration")) == null) {
  419.          super.errors.addElement(new ParserException(215, this.owner.getName()));
  420.       }
  421.  
  422.       if ((!this.isGlobal() || !var1.isSupported("GESTALT_GLOBAL_ATTRS")) && !this.isOwnerDeclared()) {
  423.          super.errors.addElement(new ParserException(215, this.owner.getName()));
  424.       }
  425.  
  426.       if (this.isReference() && this.getReferent(var1) == null) {
  427.          super.errors.addElement(new ParserException(264, ((BaseDeclaration)this).getName()));
  428.       }
  429.  
  430.       if (this.isGlobal()) {
  431.          AttributeDeclaration var2 = var1.getNamedAttribute((String)null, ((BaseDeclaration)this).getName());
  432.          if (var2 != null && var2 != this) {
  433.             super.errors.addElement(new ParserException(265, ((BaseDeclaration)this).getName()));
  434.          }
  435.       }
  436.  
  437.       if (this.getDataType().equals(2) && this.defaultValue != null && this.defaultValue.length() > 0) {
  438.          super.errors.addElement(new ParserException(216, this.defaultValue));
  439.       }
  440.  
  441.       if (((BaseDeclaration)this).getName().equals("xmlns")) {
  442.          super.errors.addElement(new ParserException(271, ((BaseDeclaration)this).getName()));
  443.       }
  444.  
  445.       if (this.getDataType().isNotation()) {
  446.          Vector var6 = this.getChoices();
  447.          if (var6 != null && var6.size() > 0) {
  448.             if (var6.size() != 1 || ((String)var6.elementAt(0)).length() != 0) {
  449.                for(int var3 = 0; var3 < var6.size(); ++var3) {
  450.                   if (!DTDParser.isName((String)var6.elementAt(var3))) {
  451.                      super.errors.addElement(new ParserException(217, (String)var6.elementAt(var3)));
  452.                   }
  453.                }
  454.             } else {
  455.                super.errors.addElement(new ParserException(234, ""));
  456.             }
  457.          } else {
  458.             super.errors.addElement(new ParserException(234, ""));
  459.          }
  460.       }
  461.  
  462.       if (this.defaultValue != null && this.defaultValue.length() > 0) {
  463.          if ((this.getDataType().equals(2) || this.getDataType().equals(3) || this.getDataType().equals(5)) && !DTDParser.isName(this.defaultValue)) {
  464.             super.errors.addElement(new ParserException(217, this.defaultValue));
  465.          }
  466.  
  467.          if ((this.getDataType().equals(4) || this.getDataType().equals(6)) && !DTDParser.isNames(this.defaultValue)) {
  468.             super.errors.addElement(new ParserException(217, this.defaultValue));
  469.          }
  470.  
  471.          if (this.getDataType().equals(7) && !DTDParser.isNmToken(this.defaultValue)) {
  472.             super.errors.addElement(new ParserException(217, this.defaultValue));
  473.          }
  474.  
  475.          if (this.getDataType().equals(8) && !DTDParser.isNmTokens(this.defaultValue)) {
  476.             super.errors.addElement(new ParserException(217, this.defaultValue));
  477.          }
  478.  
  479.          if (this.getDataType().equals(5) || this.getDataType().equals(6)) {
  480.             try {
  481.                Vector var7 = DTDUtilities.parseNameList(this.defaultValue, '\u0000');
  482.  
  483.                for(int var9 = 0; var9 < var7.size(); ++var9) {
  484.                   ExternalGEDeclaration var4 = (ExternalGEDeclaration)var1.getNamedDeclaration((String)var7.elementAt(var9), Class.forName("com.extensibility.xml.ExternalGEDeclaration"));
  485.                   if (var4 == null) {
  486.                      super.errors.addElement(new ParserException(218, this.defaultValue));
  487.                   } else if (!var4.isUnparsed()) {
  488.                      super.errors.addElement(new ParserException(219, this.defaultValue));
  489.                   }
  490.                }
  491.             } catch (ParserException var5) {
  492.                super.errors.addElement(new ParserException(220, this.defaultValue));
  493.             }
  494.          }
  495.  
  496.          if (this.dataType != null && this.dataType.hasFacet(Facet.FACET_ENUM_NAME)) {
  497.             Enumeration var8 = this.getChoices(var1, true);
  498.             boolean var10 = false;
  499.  
  500.             while(var8.hasMoreElements() && !var10) {
  501.                String var11 = (String)var8.nextElement();
  502.                if (this.defaultValue != null && this.defaultValue.equals(var11)) {
  503.                   var10 = true;
  504.                }
  505.             }
  506.  
  507.             if (!var10) {
  508.                super.errors.addElement(new ParserException(235, this.defaultValue == null ? "" : this.defaultValue));
  509.             }
  510.          }
  511.       }
  512.  
  513.    }
  514.  
  515.    public boolean equals(AttributeDeclaration var1) {
  516.       Debug.assert(false, "Get rid of all equals calls on AttributeDeclaration");
  517.       return this.canAggregateWith(var1);
  518.    }
  519.  
  520.    public boolean canAggregateWith(AttributeDeclaration var1) {
  521.       return this.required == var1.getRequired() && super.name.equals(((BaseDeclaration)var1).getName()) && (this.defaultValue == null ? var1.getDefault() == null : this.defaultValue.equals(var1.getDefault())) && this.dataType.equals(var1.dataType);
  522.    }
  523.  
  524.    public int compareTo(AttributeDeclaration var1) {
  525.       Debug.assert(false, "Get rid of all compareTo calls on AttributeDeclaration");
  526.       return this.compareAttrTo(var1);
  527.    }
  528.  
  529.    public int compareAttrTo(AttributeDeclaration var1) {
  530.       int var2 = super.errors.size() - var1.errors.size();
  531.       if (var2 != 0) {
  532.          return var2;
  533.       } else {
  534.          var2 = super.name.compareTo(((BaseDeclaration)var1).getName());
  535.          if (var2 != 0) {
  536.             return var2;
  537.          } else {
  538.             var2 = (this.required ? 1 : 0) - (var1.getRequired() ? 1 : 0);
  539.             if (var2 != 0) {
  540.                return var2;
  541.             } else {
  542.                var2 = (this.defaultValue != null ? 1 : 0) - (var1.getDefault() != null ? 1 : 0);
  543.                if (var2 != 0) {
  544.                   return var2;
  545.                } else {
  546.                   if (this.defaultValue != null) {
  547.                      var2 = this.defaultValue.compareTo(var1.getDefault());
  548.                      if (var2 != 0) {
  549.                         return var2;
  550.                      }
  551.                   }
  552.  
  553.                   var2 = ((BaseDeclaration)this).getURI().compareTo(((BaseDeclaration)var1).getURI());
  554.                   if (var2 != 0) {
  555.                      return var2;
  556.                   } else {
  557.                      var2 = this.dataType.compareTo(var1.dataType);
  558.                      if (var2 != 0) {
  559.                         return var2;
  560.                      } else {
  561.                         var2 = (this.getChoices() != null ? 1 : 0) - (var1.getChoices() != null ? 1 : 0);
  562.                         if (var2 != 0) {
  563.                            return var2;
  564.                         } else {
  565.                            if (this.getChoices() != null) {
  566.                               Enumeration var3 = this.getChoices().elements();
  567.                               Enumeration var4 = var1.getChoices().elements();
  568.  
  569.                               while(var3.hasMoreElements()) {
  570.                                  if (!var4.hasMoreElements()) {
  571.                                     return 1;
  572.                                  }
  573.  
  574.                                  var2 = ((String)var3.nextElement()).compareTo((String)var4.nextElement());
  575.                                  if (var2 != 0) {
  576.                                     return var2;
  577.                                  }
  578.                               }
  579.  
  580.                               if (var4.hasMoreElements()) {
  581.                                  return -1;
  582.                               }
  583.                            }
  584.  
  585.                            if (super.errors.size() > 0) {
  586.                               return -1;
  587.                            } else {
  588.                               return !this.isGlobal() && !var1.isGlobal() ? 0 : -1;
  589.                            }
  590.                         }
  591.                      }
  592.                   }
  593.                }
  594.             }
  595.          }
  596.       }
  597.    }
  598.  
  599.    public String getSource() {
  600.       String var1 = this.owner.getName();
  601.       if (var1.length() == 0) {
  602.          var1 = "MISSING_NAME";
  603.       }
  604.  
  605.       StringBuffer var2 = new StringBuffer("<!ATTLIST ");
  606.       var2.append(String.valueOf(String.valueOf(String.valueOf(String.valueOf(String.valueOf(this.owner.getName()).concat(String.valueOf(" "))).concat(String.valueOf(super.name))).concat(String.valueOf(" "))).concat(String.valueOf(this.getTypeAsPrimitiveSource()))).concat(String.valueOf(" ")));
  607.       var2.append(this.getChoicesSource((String)null));
  608.       var2.append(this.getDefaultSource('"', (String)null));
  609.       var2.append(String.valueOf(">").concat(String.valueOf(BaseDeclaration.LINE_SEPARATOR)));
  610.       return var2.toString();
  611.    }
  612.  
  613.    boolean isOwnerDeclared() {
  614.       return this.getOwner() instanceof ElementDeclaration || this.getOwner() instanceof InternalPEDeclaration;
  615.    }
  616.  
  617.    public boolean isGlobal() {
  618.       return !this.isOwnerDeclared() && this.owner != null && this.owner.getName().length() == 0;
  619.    }
  620.  
  621.    public boolean isReference() {
  622.       return this.isReferenceToGlobal && !this.isGlobal();
  623.    }
  624.  
  625.    public void setReference(boolean var1) {
  626.       this.isReferenceToGlobal = var1;
  627.    }
  628.  
  629.    public AttributeDeclaration getReferent(SchemaIntf var1) {
  630.       return !this.isReference() ? null : var1.getNamedAttribute((String)null, ((BaseDeclaration)this).getName());
  631.    }
  632.  
  633.    public void write(Writer var1) throws IOException {
  634.       if (!this.isOwnerDeclared()) {
  635.          super.write(var1);
  636.       }
  637.    }
  638.  
  639.    private void setDataType(DataType var1, boolean var2) {
  640.       DataType var3 = this.dataType;
  641.       if (this.dataType != null) {
  642.          this.dataType.release();
  643.          this.dataType.removeChangeListener(this.changerType);
  644.       }
  645.  
  646.       this.dataType = var1;
  647.       if (this.dataType != null) {
  648.          if (((BaseDeclaration)this).getSchema() != null) {
  649.             this.dataType.bind(((BaseDeclaration)this).getSchema());
  650.          }
  651.  
  652.          this.dataType.addChangeListener(this.changerType);
  653.       }
  654.  
  655.       if (var2) {
  656.          ((BaseDeclaration)this).fireChangeEvent(14, var3);
  657.       }
  658.  
  659.    }
  660.  
  661.    public void setDataType(DataType var1) {
  662.       this.setDataType(var1, true);
  663.    }
  664.  
  665.    public DataType getDataType() {
  666.       return this.dataType;
  667.    }
  668.  
  669.    public String getSampleData() {
  670.       if (super.sampleData == null) {
  671.          String var1 = this.getDefault();
  672.          if (var1 == null) {
  673.             var1 = this.getRequired() ? "required" : "optional";
  674.          }
  675.  
  676.          if (this.getDataType() != null) {
  677.             try {
  678.                var1 = BaseDeclaration.resourceBundle.getString(String.valueOf("xml.exemplar.dt.").concat(String.valueOf(this.getDataType().getSource())));
  679.             } catch (MissingResourceException var3) {
  680.             }
  681.          }
  682.  
  683.          return var1;
  684.       } else {
  685.          return super.sampleData;
  686.       }
  687.    }
  688.  
  689.    protected void releaseBindings() {
  690.       if (this.dataType != null) {
  691.          this.dataType.release();
  692.       }
  693.  
  694.    }
  695.  
  696.    protected void establishBindings() {
  697.       if (this.dataType != null) {
  698.          this.dataType.bind(((BaseDeclaration)this).getSchema());
  699.       }
  700.  
  701.    }
  702. }
  703.